#ifndef numuCCPXAnalysis_h
#define numuCCPXAnalysis_h

#include "numuCCAnalysis.hxx"
#include "numuCCPXSelection.hxx"


class numuCCPXAnalysis: public baseAnalysis {
public:
  enum ccpxvar{
    ntrackertracks = numuCCAnalysis::enumStandardMicroTreesLast_numuCCAnalysis + 1,

    eventtypesim,
    simotherpdg,

    necaltracks,
    ecalpdgsim,

    selp_truemom, selp_truedir, selp_pdg, selp_tpc_nhits, selp_endpos, selp_dir, selp_mom, selp_NDOF, selp_Chi2, selp_ntpcs,
    selX_truemom, selX_truedir, selX_pdg, selX_tpc_nhits, selX_endpos, selX_dir, selX_mom, selX_NDOF, selX_Chi2, selX_ntpcs,
    selX_charge, 
    selX_PID,

    ccpxvar_last
  };

  numuCCPXAnalysis(AnalysisAlgorithm* ana=NULL);
  virtual ~numuCCPXAnalysis(){}

  void FillParticle(ccpxvar truemom, ccpxvar truedir, ccpxvar pdg, ccpxvar tpc_nhits, ccpxvar endpos, ccpxvar dir, ccpxvar mom, ccpxvar NDOF, ccpxvar Chi2, AnaTrackB* tmppar);
  void FillCategories();

  //---- These are mandatory functions
  void DefineSelections();
  bool Process();
  void DefineMicroTrees(bool addBase=true);
  void FillMicroTrees(bool addBase=true);
  void FillToyVarsInMicroTrees(bool addBase=true);
  void InitializeConfiguration();
  void DefineConfigurations();
  void DefineCorrections();
  void DefineSystematics();
  void DefineTruthTree();
  void FillTruthTree(const AnaTrueVertex& vtx);
  bool CheckFillTruthTree(const AnaTrueVertex& vtx);
  bool CheckFillRooTracker(const AnaTrueVertex& vtx);
  void InitializeToy();
  void FinalizeToy();

protected:

  AnaBoxCCPX* _ccPX_box;

  AnaBoxCCPX& box(){return *_ccPX_box;}

  numuCCAnalysis* _numuCCAnalysis;
};

#endif
